<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018\6\14 0014
 * Time: 17:14
 */
//define('LIVE_GUDINGYI_LIST','gudingyi');
//define('LIVE_DUOXUANYI_LIST','duoxuanyi');
$live_types = ['gudingyi', 'duoxuanyi','hwsp','soujiu'];

//实例化redis
$redis = new Redis();
//连接
$redis->connect('127.0.0.1', 6379);
//检测是否连接成功
echo "Server is running: " . $redis->ping() .'<br/>';



foreach( $live_types as $type ){
    $list = $redis->lrange($type, 0, -1);
    if( !empty($_GET[ $type ]) ){

        $value = $_GET[ $type ];

        if( empty($list) || $list[0] != $value ){
            $redis->lpush($type, $value);
        }
    }

    $list2 = $redis->lrange($type, 0, -1);
    echo $type . ':';
    print_r( $list2 );
    echo '<br />';
}